package com.shirley.pers.zhufengfmvi.entities;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Description: 小编推荐和听新闻...<br/>
 * <p/>
 * Copyright (c) , 2016, Shirley Xian <br/>
 * This program is protected by copyright laws. <br/>
 * ClassName: RecommendAlbums<br/>
 * Date: 2016/4/6 16:53
 *
 * @author Shirley Xian
 * @version 1.0
 */
public class RecommendAlbums extends DiscoveryRecommendItem {
    private List<RecommendAlbumInfo> albums;

    /**
     * 用于解析小编和热门推荐的内容
     *
     * @param json
     */
    public void parseJson(JSONObject json) throws JSONException {
        super.parseJson(json);
        if (json != null) {
            JSONArray array = json.getJSONArray("list");
            albums = new ArrayList<>();
            for (int i = 0; i < array.length(); i++) {
                JSONObject jsonObject = array.getJSONObject(i);
                RecommendAlbumInfo albumInfo = new RecommendAlbumInfo();
                albumInfo.parseJson(jsonObject);
                albums.add(albumInfo);
            }
        }
    }

    public List<RecommendAlbumInfo> getAlbums() {
        return albums;
    }
}
